﻿<Window x:Class="NavigationPaneDemo.TestWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:s="NavigationPane"
        x:Name="window"
        Title="TestWindow"
        Width="520"
        Height="494"
        WindowStartupLocation="CenterScreen"
        mc:Ignorable="d">
    <Window.Resources>

        <SolidColorBrush x:Key="Brush1" Color="Black" />
        <DataTemplate x:Key="DataTemplate1">
            <Grid>
                <TextBlock Text="TextBlock"
                           TextWrapping="Wrap"
                           d:LayoutOverrides="Height" />
                <Image x:Name="image"
                       Width="16"
                       Height="16"
                       HorizontalAlignment="Left"
                       Source="Resources/mail.ico"
                       Stretch="Fill" />
            </Grid>
            <DataTemplate.Triggers />
        </DataTemplate>
        <s:BooleanNegateConverter x:Key="BooleanNegateConverter" />
        <Style x:Key="NavigationPaneItemStyle1" TargetType="{x:Type s:NavigationPaneItem}">
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type s:NavigationPaneItem}">
                        <DockPanel>
                            <s:NavigationPaneButton x:Name="PART_ItemButton"
                                                    Margin="{DynamicResource {ComponentResourceKey ResourceId=LargeItemsMargin,
                                                                                                   TypeInTargetAssembly={x:Type s:NavigationPane}}}"
                                                    Anchor="Top"
                                                    CheckMode="Check"
                                                    Content="{TemplateBinding Header}"
                                                    ContentStringFormat="{TemplateBinding HeaderStringFormat}"
                                                    ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                    ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                                    DockPanel.Dock="Top"
                                                    FontWeight="Bold"
                                                    Foreground="{DynamicResource {ComponentResourceKey ResourceId=ForeColorInactive,
                                                                                                       TypeInTargetAssembly={x:Type s:NavigationPane}}}"
                                                    Image="{TemplateBinding Image}"
                                                    ImageSmall="{TemplateBinding ImageSmall}"
                                                    ImageType="Large"
                                                    IsChecked="{Binding IsSelected,
                                                                        Mode=TwoWay,
                                                                        RelativeSource={RelativeSource TemplatedParent}}"
                                                    IsContentVisible="{Binding IsMinimized,
                                                                               Converter={StaticResource BooleanNegateConverter},
                                                                               RelativeSource={RelativeSource FindAncestor,
                                                                                                              AncestorType={x:Type s:NavigationPane}}}"
                                                    Padding="{DynamicResource {ComponentResourceKey ResourceId=LargeItemsPadding,
                                                                                                    TypeInTargetAssembly={x:Type s:NavigationPane}}}"
                                                    ToolTip="{TemplateBinding ButtonToolTipGesture}" />
                            <ContentPresenter x:Name="contentPresenter"
                                              Content="{TemplateBinding Content}"
                                              ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                              ContentTemplate="{TemplateBinding ContentTemplate}"
                                              ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                              DockPanel.Dock="Top" />
                        </DockPanel>
                        <ControlTemplate.Triggers>
                            <Trigger Property="Selector.IsSelected" Value="True">
                                <Setter TargetName="PART_ItemButton" Property="Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ForeColorActive, TypeInTargetAssembly={x:Type s:NavigationPane}}}" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="PART_ItemButton" Property="Foreground" Value="{DynamicResource {ComponentResourceKey ResourceId=ForeColorActive, TypeInTargetAssembly={x:Type s:NavigationPane}}}" />
                            </Trigger>
                            <Trigger Property="IsInsideNavigationPane" Value="True">
                                <Setter TargetName="contentPresenter" Property="Visibility" Value="Collapsed" />
                            </Trigger>
                            <Trigger Property="s:NavigationPanePanel.ItemDisplayType" Value="Small">
                                <Setter TargetName="PART_ItemButton" Property="IsContentVisible" Value="False" />
                                <Setter TargetName="PART_ItemButton" Property="Margin" Value="-1,0,0,0" />
                                <Setter TargetName="PART_ItemButton" Property="DockPanel.Dock" Value="Right" />
                                <Setter TargetName="PART_ItemButton" Property="ImageType" Value="Small" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <DataTemplate x:Key="DataTemplate2">
            <Grid>
                <Rectangle Fill="#FF2323D2" Stroke="Black" />
            </Grid>
        </DataTemplate>

    </Window.Resources>
    <Grid Background="{DynamicResource Brush1}">
        <s:NavigationPane Width="176"
                          HorizontalAlignment="Left"
                          ContentTemplate="{DynamicResource DataTemplate2}"
                          ItemsSource="{Binding Resources.Keys,
                                                ElementName=window}"
                          ItemTemplate="{DynamicResource DataTemplate1}"
                          SelectedIndex="0" />
    </Grid>
</Window>
